package com.universe.objects;

import java.util.ArrayList;
import java.util.List;


public class Universe {
	private List<Body> bodies;
	private double dT;
	private double size;
	
	public Universe(double dT, double size, Body... bodies){
		this.dT = dT;
		this.size = size;
		this.bodies = new ArrayList<Body>();
		for(Body b : bodies){
			this.bodies.add(b);
		}
	}
	
	public double getSize(){
		return size;
	}
	
	public List<Body> getBodies(){
		return bodies;
	}
	
	public void iterate(){
		for(int i=0; i<bodies.size(); i++){
			for(int j=0; j<bodies.size(); j++){
				if(i!=j){
					bodies.get(i).addBodyInfluence(bodies.get(j));
				}
			}
		}
		for(Body b : bodies){
			b.move(dT);
		}
	}
}
